package com.wenhao.yy;

import java.util.ArrayList;

/**
 * @author Wenhao Tong
 * @create 2021-09-04 19:02
 */
public class Main {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     *
     * @param data double浮点型一维数组
     * @return double浮点型ArrayList
     */
    public ArrayList<Double> findPoints (double[] data) {
        // write code here
        ArrayList<Double> list = new ArrayList<>();
        int[] result = new int[data.length];
        double max = data[0];
        double min = data[data.length - 1];
        for (int i = data.length - 2;i > -1;i--) {
            if (data[i] < min) {
                min = data[i];
                result[i] += 1;
            }
        }
        for (int i = 1;i < data.length;i++) {
            if (data[i] > max) {
                max = data[i];
                if (result[i] == 1) {
                    list.add(data[i]);
                }
            }
        }
        return list;
    }
}
